package com.quanquan.store.entity;

import lombok.Data;

import javax.persistence.*;

@Data
@Entity
@Table(name = "oo_group_buying_trading_record")
public class GroupBuyingTradingRecord {

    @Id
    @Column(name = "id", unique = true, length = 64)
    private String id;

    /**
     * 用户id
     */
    @Column(name = "user_id", nullable = false, length = 32)
    private String userId;

    /**
     * 团购活动id
     */
    @Column(name = "group_buying_id", nullable = false, length = 32)
    private String groupBuyingId;

    /**
     *支付类型  integral 积分  money 现金 combination 组合支付
     **/
    @Column(name = "pay_type",length = 64)
    private String payType;

    /**
     * 商品id
     */
    @Column(name = "good_id", nullable = false, length = 32)
    private String goodId;


    /**
     * 商品类型
     */
    @Column(name = "goods_type", nullable = false, length = 32)
    private String goodsType;

    /**
     * 支付价格
     */
    @Column(name = "price",  columnDefinition = "DOUBLE")
    private Double price;

    @Column(name = "integral",  columnDefinition = "INT")
    private Integer integral;
    /**
     * 订单号
     */
    @Column(name = "order_number", nullable = false, length = 32)
    private String orderNumber;
    /**
     * 创建时间
     */

    @Column(name = "create_time", nullable = false, length = 32)
    private String createTime;

    /**
     * 申请状态
     */
    @Column(name = "trading_status",length = 32)
    @Enumerated(EnumType.STRING)
    private GroupBuyingTradingRecord.TradingStatus tradingStatus;

    public enum TradingStatus {
        /**
         * 待支付  已支付 已失效（过期）退款中，已退款,参团成功
         */
        unpaid, paid ,overdue,refunding,refund,success
    }

    /**
     * 微信支付单号
     */
    @Column(name = "transaction_id",length = 32)
    private String transactionId;

    /**
     * 支付时间
     **/
    @Column(name = "payTime",length = 32)
    private String payTime;

    /**
     * 秒杀商品分面
     */
    @Transient
    private String coverImg;

    /**
     * 秒杀商品名字
     */
    @Transient
    private String groupBuyingName;


}
